department = jQuery.noConflict();

department().ready(function() {

	/* var addNewSpan = '<span id="errormsg_container"></span>';
        department("#announcements-node-form").before(addNewSpan);*/
	
  department("#profile-node-form").validate({
										/* onfocusout: false,
  										 onkeyup: false,
  										 onclick: false,*/
										 //debug:true,
										 
					rules: {
						'field_pro_dept[und]': { 
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
						
						},
						'title': { 
							required: true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
						},
						'field_pro_pro[und][0][value]':{
							required: true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,							
							},
						'field_pro_other[und][0][value]':{
							required: true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,							
							},
						'language':{
							maxlength: 100,
							chkbadchar:true,							
							},
						
						
						
					
					},
                    messages: {
						'field_pro_dept[und]': { 
							required: 'Please Select Department',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							valuenotequals: 'Please Select Concerned Department',
							},
								'title': { 
							required: 'Please Enter Title',
							minlength: 'Minimum 5 characters should be entered',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',	
							
							},
							'field_pro_pro[und][0][value]':{
							required: 'Please Enter Department Profile',
							minlength: 'Minimum 5 characters should be entered',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',	
							
							},
							'field_pro_other[und][0][value]':{
							required:  'Please enter other information',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',
							},
							'language':{
							maxlength:  'Maximum 200 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',						
							},
							
	
				}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							//  department("#announcements-node-form").create_errormsg_container('errormsg_container','announcements-node-form');
						}
							
							department('html, body').animate({
								scrollTop: department(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});
 /*errorLabelContainer: "#announcements-node-form",
						wrapper: "li",
  
	});
/*  errorPlacement: function(error, element) {
        element = element.closest('li');
        element = element.children(':first-child');
        error.insertBefore(element);
        error.addClass('message');
        department(function() {                                 // my function
            var errorIndex = department(error).index('div');
            var errorId = 'errordiv' + errorIndex.toString();
            department(error).attr('id', errorId);
            department('.errorList').append('<li><a href="#' + errorId + '">' + department(error).text() + '</a></li>');
			department("#announcements-node-form").before(element);
        });    
    },
*/

//// Title Validation
//    department('#edit-title').rules("add", { 
//    		//notaccept: {'exp':"[a-zA-Z]+"},
//			chkbadchar: true,
//    		//required: true,
//         	minlength: 0,
//         messages: {
//            // required: "Title is required"  ,
//           // notaccept: 'Number is Not Allowed',
//			chkbadchar:'blah blah'
//         }
//        
//     });

            
});
